package com.treeroot.springbootwithmybatis.controller;

import com.treeroot.springbootwithmybatis.entity.Emp;
import com.treeroot.springbootwithmybatis.service.Impl.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * springboot整和mybatis
 */
@RestController
@RequestMapping("mb")
public class EmpController {
    @Autowired
    private EmpService empService;

    @GetMapping("/all")
    public List<Emp> queryList() {
        List<Emp> list = empService.getAllEmp();
        list.forEach(System.out::println);
        return list;
    }
}
